Memories are used in electronic systems and circuits to store data that can be retrieved for later processing, for example, by a processor. Data can be written to the memory as well as read from memory at a later time. In more advanced memories basic operations may be performed by logic in the memory itself in order to save a processor from having to issue multiple memory commands to the memory as well as manage the operation. For example, a processor may issue a single “read-modify-write” command to a memory, and the memory manages the steps of retrieving data from memory, performing operations on the data, and writing the resultant data back to memory. Thus, although one memory command is issued to the memory, the memory itself manages and performs multiple operations that involve accessing data stored in a memory and performing operations on the data. These commands may be referred to “atomic memory operations.” These operations are called “atomic” because they are performed indivisibly: as a single sequence that cannot be interrupted or subdivided. If a processor has to update a shared memory item, then additional operations must be executed to prevent sharing processors from accessing and/or modifying the data item while the first processor is executing the update before returning the updated data to memory. By putting the update operation more directly in memory, shared items can be updated without coherency overhead, more quickly, and with reduced energy expenditure.
Memories and the control logic that perform atomic memory operations may not have flexibility to accommodate operations on data of different sizes. That is, the memory may be designed to perform operations on data having a certain length, and data units of a certain size. Performing operations on smaller data units (e.g., performing an operation on a byte of data although 4-bytes of data are retrieved) will consume an entire operation cycle although only the results for the smaller data unit is desired. The results from performing the operation on the other data units is discarded. Performing operations on particular data may also require multiple operations due to the fact that the desired data may be stored in an manner that requires multiple different blocks of data to be retrieved and the operation using data from different blocks cannot be performed in a single simple sequence or efficiently.
Therefore, it is desirable to have a memory capable of performing atomic memory operations that also provides flexibility in operand and data size independently from how particular memory operations are implemented.